import request from '@/utils/request'

// 获取业务列表
export const getBusinesses = (params) => {
  return request({
    url: '/businesses',
    method: 'get',
    params
  })
}

// 获取业务详情
export const getBusiness = (id) => {
  return request({
    url: `/businesses/${id}`,
    method: 'get'
  })
}

// 创建业务
export const createBusiness = (data) => {
  return request({
    url: '/businesses',
    method: 'post',
    data
  })
}

// 更新业务
export const updateBusiness = (id, data) => {
  return request({
    url: `/businesses/${id}`,
    method: 'put',
    data
  })
}

// 删除业务
export const deleteBusiness = (id) => {
  return request({
    url: `/businesses/${id}`,
    method: 'delete'
  })
}

// 更新业务状态
export const updateBusinessStatus = (id, status) => {
  return request({
    url: `/businesses/${id}/status`,
    method: 'patch',
    data: { businessStatus: status }
  })
}

// 更新业务进度备注
export const updateBusinessProgress = (id, progressNotes) => {
  return request({
    url: `/businesses/${id}/progress`,
    method: 'patch',
    data: { progressNotes }
  })
}

// 获取业务统计信息
export const getBusinessStats = (params) => {
  return request({
    url: '/businesses/stats',
    method: 'get',
    params
  })
}

// 获取客户业务统计
export const getCustomerBusinessStats = () => {
  return request({
    url: '/businesses/customer-stats',
    method: 'get'
  })
} 